package org.yate.oa.service.imp;

import java.util.List;

import javax.annotation.Resource;

import org.springframework.stereotype.Service;
import org.yate.oa.dao.IBaseMapperDao;
import org.yate.oa.dao.mapper.UserMapper;
import org.yate.oa.model.UserEntity;
import org.yate.oa.service.IUserService;
import org.yate.oa.utils.Pagination;

@Service
public class UserService extends BaseService<UserEntity, Integer> implements IUserService {
	@Resource(name = "userMapper")
	private UserMapper userDao;

	@Override
	protected IBaseMapperDao<UserEntity, Integer> getMapperDao() {
		return this.userDao;
	}

	public Integer addUser(final UserEntity e) {
		return userDao.addUser(e);
	}

	@Override
	public Pagination<UserEntity> getEntitiesByOrdId(int page, int rows, String orderField, String orderMode, String... strings) {
		Pagination<UserEntity> result = new Pagination<UserEntity>(page, rows);
		result.setRows(this.userDao.getEntitiesByOrdId(result, orderField, orderMode, strings));
		return result;
	}

	@Override
	public List<UserEntity> getAllUsers() {
		return userDao.getAllUsers();
	}

    @Override
    public List<UserEntity> getAllUsersByOrgId(List<Integer> ids)
    {
        return userDao.getAllUsersByOrgId(ids);
    }

	@Override
	public void updatePassword(UserEntity e) {
		userDao.updatePassword(e);
	}

    @Override
    public UserEntity getEntityByUserName(String... strings)
    {
       return this.userDao.getEntityByUserName(strings);
    }

    @Override
    public List<UserEntity> getEntityBy(UserEntity u)
    {
        return this.userDao.getEntityBy(u);
    }
}
